<?php 
session_start();
$myconn=mysql_connect("localhost","root","2816843");
mysql_select_db("zy_account_system",$myconn);
mysql_query("SET NAMES 'utf8'");
function create_invite_code(){
	$pattern = '1234567890abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLOMNOPQRSTUVWXYZ';
	for($i = 0; $i <6; $i++) {
		$invite_code .= $pattern{mt_rand(0, 61)};
	}
	$sql="select invite_code from zy_user where invite_code ='".$invite_code."'";
	$rs = mysql_query($sql);
	if ($rs) {
		return $invite_code;
	}else{
		create_invite_code();
	}
}
	